import 'package:flutter/material.dart';
import 'package:jdflutter/flutter_jdshop/services/ScreenAdaper.dart';
import 'package:provider/provider.dart';
import '../../provider/Counter.dart';
import '../Cart/CartItem.dart';
import '../Cart/CartNum.dart';
import '../../provider/Cart.dart';
class CartPage extends StatefulWidget {
 // const CartPage({Key? key}) : super(key: key);

  @override
  _CartPageState createState() => _CartPageState();
}

class _CartPageState extends State<CartPage> {

  @override
  void initState(){
    super.initState();
    print("cart");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar:AppBar(
        title: Text("购物车"),
        actions: [
          IconButton(onPressed: null,
              icon: Icon(Icons.launch))
        ],

      ),

      body: Stack(
        children: [
          ListView(
            children: [
              CartItem(),
              CartItem(),
              CartItem()
            ],
          ),
          Positioned(
            bottom: 0,
            width: ScreenAdaper.width(750),
            height: ScreenAdaper.height(78),
            child: Container(
              decoration: BoxDecoration(
                border: Border(
                    top: BorderSide(
                        width: 1,
                        color: Colors.black12
                    )
                ),
                color: Colors.white,
              ),
              width: ScreenAdaper.width(750),
              height: ScreenAdaper.height(78),
              child: Stack(
                children: <Widget>[
                  Align(
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: <Widget>[
                        Container(
                          width: ScreenAdaper.width(60),
                          child: Checkbox(
                            value: true,
                            activeColor: Colors.pink,
                            onChanged: (val) {},
                          ),
                        ),
                        Text("全选")
                      ],
                    ),
                  ),
                  Align(
                    alignment: Alignment.centerRight,
                    child: ElevatedButton(
                      child: Text("结算",style: TextStyle(
                          color: Colors.white
                      )),
                      style:ButtonStyle(
                        backgroundColor:MaterialStateProperty.all(Colors.red),
                      ),
                      onPressed: (){

                      },
                    ),
                  )
                ],
              ),
            ),
          )
        ],
      )

    );
  }
}


